﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Suzsoft.Smart.Data;

namespace ESOL.Business.ProcessingService
{
    public class ProdCapacityService
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        public static DataTable GetCapacityForTime(DateTime start, DateTime end)
        {
            string sql = @"select CODE,sum(CAPACITY_TIME) as CAPACITY_TIME from v_prod_capacity where 1=1 ";
            if (start != null)
                sql += "and plan_starttime>='" + start.ToString() + "' ";
            if (end != null)
                sql += "and plan_endtime<='" + end.ToString() + "'";
            sql += "group by CODE";
            return DataAccess.SelectDataSet(sql).Tables[0];
        }
    }
}
